#!/usr/bin/python3
#练习一学生情况
import statistics
class Student:
    def __init__(self,name,age,gender,birth,high,kilometer,python_score,math_score,english_score):
        self.name = name
        self.age = age
        self.gender= gender
        self.birth = birth
        self.high = high
        self.kilometer = kilometer
        self.python_score = python_score
        self.math_score = math_score
        self.english_score = english_score
    def run(self):
        high = self.high+ 1
        kilometer = self.kilometer - 0.5
        print(f'跑步：身高={high},体重={kilometer}')
    def eat(self):
        high1 = self.high + 1
        kilometer1 = self.kilometer + 0.5
        print(f'吃饭：身高={high1},体重={kilometer1}')
    def study(self):
        math_score = self.math_score + 1
        english_score =self.english_score + 1
        python_score = self.python_score +1
        print(f'三科成绩分别：数学={math_score}英语={english_score}pyhon={python_score}')
    def sleep(self):
        print(f'我叫{self.name},今年{self.age}岁，性别{self.gender},出生于{self.birth},身高{self.high},体重{self.kilometer},python成绩{self.python_score},数学成绩{self.math_score},英语成绩{self.english_score}')
    def sum_score(self):
        sum_score = [self.python_score,self.math_score,self.english_score]
        return sum(sum_score)


    def average_score(self):
        average_score = [self.python_score,self.math_score,self.english_score]
        print(statistics.mean(average_score))

if __name__ == '__main__':
    stu1 = Student('小红',16,'女','2003-05-17',163,51,68,79,90)
    stu1.run()
    stu1.eat()
    stu1.study()
    stu1.sleep()
    stu1.sum_score()
    stu1.average_score()
#练习9-1
class Restaurant:
    def __init__(self,restaurant_name,cuisine_type):
        self.restaurant_name = restaurant_name
        self.cuisine_type = cuisine_type

    def describe_restaurant(self):
        print(f'{self.restaurant_name},{self.cuisine_type}')

    def open_restaurant(self):
        print(f'{self.restaurant_name}正在营业')


if __name__ == '__main__':
   re1 = Restaurant("享受美食","川菜")
   print(f'{re1.restaurant_name},{re1.cuisine_type}')
   re1.describe_restaurant()
   re1.open_restaurant()
   re2 = Restaurant("开心餐吧","西餐")
   print(f'{re2.restaurant_name},{re2.cuisine_type}')
   re2.describe_restaurant()
   re2.open_restaurant()



# 二、定义一个字典类：dictclass。完成下面的功能：
# dict = dictclass({你需要操作的字典对象})
# 1 删除某个key
# del_dict(key)
# 2 判断某个键是否在字典里，如果在返回键对应的值，不存在则返回"not found"
# get_dict(key)
# 3 返回键组成的列表：返回类型;(list)
# get_key()
# 4 合并字典，并且返回合并后字典的values组成的列表。返回类型:(list)update_dict({要合并的字典})# """

class Dictclass:
    def __init__(self, tt87676):
        self.dic = tt87676

    def del_dict(self,iuiooiu):
        del self.dic[iuiooiu]
        print(self.dic)

    def get_dict(self,key):
        if key in self.dic:
            return self.dic[key]
        else:
            return 'not found'


if __name__ == '__main__':

    a = Dictclass({'name': '小花','age':16})
    a.del_dict('name')
    # result = a.get_dict('name1')
    # print(f'{result}')





